//
//  LGFollowDetailNextCell.m
//  HeartDiseaseManage
//
//  Created by 1234 on 2023/6/15.
//

#import "LGFollowDetailNextPlanCell.h"

@interface LGFollowDetailNextPlanCell()
/**   */
@property (nonatomic , strong)UIView *baseView;
/**   */
@property (nonatomic , strong)UILabel *dateTitle;
/**   */
@property (nonatomic , strong)UILabel *dateLabel;
/**   */
@property (nonatomic , strong)UILabel *inspectTitle;
/**   */
@property (nonatomic , strong)UILabel *inspectLabel;
/**   */
@property (nonatomic , strong)UILabel *evaluateTitle;
/**   */
@property (nonatomic , strong)UILabel *evaluateLabel;

@end

@implementation LGFollowDetailNextPlanCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubView];
    }
    return  self;
}

-(void)setDataDic:(NSDictionary *)dataDic{
    _dataDic = dataDic;
    self.dateLabel.text = LGNSString(dataDic[@"visit_time"]);
    NSArray *exams = dataDic[@"exams"];
    NSArray *evas = dataDic[@"evas"];
    NSString *examString = @"";
    NSString *evaString = @"";
    for (NSInteger i=0; i<exams.count; i++) {
        examString = (examString.length>0)?[NSString stringWithFormat:@"%@、%@",examString,exams[i]]:exams[i];
    }
    for (NSInteger i=0; i<evas.count; i++) {
        evaString = (evaString.length>0)?[NSString stringWithFormat:@"%@、%@",evaString,evas[i]]:evas[i];
    }
    self.inspectLabel.text = (examString.length>0)?examString:@" ";
    self.evaluateLabel.text = (evaString.length>0)?evaString:@" ";
}

#pragma mark
#pragma mark ====> 创建控件
-(void)createSubView{
    self.clipsToBounds = YES;
    self.contentView.backgroundColor = [UIColor colorWithString:@"#F9F9F9"];
    [self.contentView addSubview:self.baseView];
    [self.baseView addSubview:self.dateTitle];
    [self.baseView addSubview:self.dateLabel];
    [self.baseView addSubview:self.inspectTitle];
    [self.baseView addSubview:self.inspectLabel];
    [self.baseView addSubview:self.evaluateTitle];
    [self.baseView addSubview:self.evaluateLabel];
    [self.baseView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(viewPix(16));
        make.right.equalTo(self.contentView).offset(-viewPix(16));
        make.top.bottom.equalTo(self.contentView);
    }];
    [self.dateTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.baseView).offset(viewPix(12));
        make.top.equalTo(self.baseView).offset(viewPix(0));
    }];
    [self.dateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.baseView).offset(viewPix(88));
        make.right.equalTo(self.baseView).offset(-viewPix(11));
        make.centerY.equalTo(self.dateTitle);
    }];
    
    [self.inspectTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.dateTitle.mas_bottom).offset(viewPix(12));
        make.left.equalTo(self.dateTitle);
    }];
    
    [self.inspectLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.inspectTitle);
        make.left.right.equalTo(self.dateLabel);
    }];
    
    [self.evaluateTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.inspectLabel.mas_bottom).offset(viewPix(12));
        make.left.equalTo(self.dateTitle);
    }];
    [self.evaluateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.evaluateTitle);
        make.left.right.equalTo(self.dateLabel);
        make.bottom.equalTo(self.baseView.mas_bottom).offset(-5);
    }];
}

-(UIView *)baseView{
    if(!_baseView){
        _baseView = [UIView shadowViewWithColor:@"#B2BDC7" offset:CGSizeMake(0, 2) opacity:0.15 radius:0];
        _baseView.backgroundColor = [UIColor whiteColor];
    }
    return _baseView;
}

-(UILabel *)dateTitle{
    if(!_dateTitle){
        _dateTitle = [UILabel lableWithText:@"复诊时间" colorString:@"#666666" textFont:LGFont(16) textAlignment:NSTextAlignmentLeft lines:1];
    }
    return _dateTitle;
}

-(UILabel *)inspectTitle{
    if(!_inspectTitle){
        _inspectTitle = [UILabel lableWithText:@"检查项目" colorString:@"#666666" textFont:LGFont(16) textAlignment:NSTextAlignmentLeft lines:1];
    }
    return _inspectTitle;
}

-(UILabel *)evaluateTitle{
    if(!_evaluateTitle){
        _evaluateTitle = [UILabel lableWithText:@"评估项目" colorString:@"#666666" textFont:LGFont(16) textAlignment:NSTextAlignmentLeft lines:1];
    }
    return _evaluateTitle;
}


-(UILabel *)dateLabel{
    if(!_dateLabel){
        _dateLabel = [UILabel lableWithText:@" " colorString:@"#333333" textFont:LGFont(16) textAlignment:NSTextAlignmentLeft lines:0];
    }
    return _dateLabel;
}

-(UILabel *)inspectLabel{
    if(!_inspectLabel){
        _inspectLabel = [UILabel lableWithText:@" " colorString:@"#333333" textFont:LGFont(16) textAlignment:NSTextAlignmentLeft lines:0];
    }
    return _inspectLabel;
}

-(UILabel *)evaluateLabel{
    if(!_evaluateLabel){
        _evaluateLabel = [UILabel lableWithText:@" " colorString:@"#333333" textFont:LGFont(16) textAlignment:NSTextAlignmentLeft lines:0];
    }
    return _evaluateLabel;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
